import { constantRoutes, asyncRoutes } from '@/router'
const state = {
  route: constantRoutes
}

const mutations = {
  setRouter(state, info) {
    state.route = [...constantRoutes, ...info]
  }
}

const actions = {
  filterRouter(context, menue) {
    const otherRouter = asyncRoutes.filter(item => {
      return menue.includes(item.children[0].name)
    })
    context.commit('setRouter', otherRouter)
    return otherRouter
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
